﻿using Fee.Orders.DesignWorkflow;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Fee.Mapping
{

    public class ConstructionTaskPlanCostMapping : IEntityTypeConfiguration<ConstructionTaskPlanCost>
    {
        public void Configure(EntityTypeBuilder<ConstructionTaskPlanCost> build)
        {
            build.HasKey(_ => _.Id);
            build.Property(_ => _.Id).ValueGeneratedOnAdd();
            build.Property(_ => _.Type);
            build.Property(f => f.Construction);
            build.Property(f => f.Design);
            build.Property(f => f.Supervisor);
            build.Property(f => f.FirstPartyMeteria);
            build.Property(f => f.TotalAmount);
            build.OwnsOne(f => f.ProcessInfo, b =>
            {
                b.Property(a => a.ConstructionOperator);
                b.Property(a => a.Number).HasMaxLength(36);
            });
            build.Property(f => f.DesignEffect);
            build.Property(f => f.SupervisorEffect);
            build.Property(f => f.ConstructionEffect);
            build.ToTable("fee_ConstPlanCost");
            build.Property(f => f.TaskId).HasColumnName("ConstructionTaskId").ValueGeneratedNever();
        }
    }
}